import { Component, OnInit } from '@angular/core';
import {Headers, Http} from '@angular/http';
import 'rxjs/Rx';
import {Observable} from 'rxjs/Observable';

export class Menu {
  constructor(
    public id: string,
    public menuName: string,
    public menuType: string,
    public menuUrl: string,
    public menuCode: string,
    public parentId: string,
    public menuIcon: string,
    public childNum: number,
    public listorder: number,
    public status: boolean,
    public createTime: string,
    public updateTime: string,
    public children: Array<Menu>) { }
}


@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})

export class HomeComponent implements OnInit {

  menuList: Observable<any>;

  isCollapsed = false;

  constructor(private http: Http) {

    const header = new Headers();
    header.set('Access-Control-Allow-Origin', '*');
    header.set('Authorization', '{aaaasdas}');

    this.menuList = this.http.get('http://www.showm.xin/console/menu/list', { headers: header})
      .map(res => res.json());
  }

  ngOnInit() {
  }

}
